#include "VideoPlayerTopBarWnd.h"

extern HINSTANCE					g_SDHResModuleHandle;

CVideoPlayerTopBarWnd::CVideoPlayerTopBarWnd()
{
}
CVideoPlayerTopBarWnd::~CVideoPlayerTopBarWnd()
{

}

BOOL CVideoPlayerTopBarWnd::Create()
{
	m_rtTopBarWnd.left = 0;
	m_rtTopBarWnd.top = 0;
	m_rtTopBarWnd.right = 800;
	m_rtTopBarWnd.bottom = 51;
//	if(!CMzWndEx::Create(DESKTOP_WND_SIZE_LEFT,DESKTOP_WND_SIZE_TOP,DESKTOP_WND_SIZE_WIDTH,DESKTOP_WND_SIZE_HEIGHT, 0, 0, 0))
	if(!CMzWndEx::Create(m_rtTopBarWnd.left,m_rtTopBarWnd.top,
		m_rtTopBarWnd.right - m_rtTopBarWnd.left,
		m_rtTopBarWnd.bottom - m_rtTopBarWnd.top, 0, 0, 0))
		return FALSE;

#if 1
	HDC hdc = GetDC(0);

	RECT rcDst;
//	GetWindowRect(m_hWnd, &rcDst);
	rcDst = m_rtTopBarWnd;
	HBITMAP hBmp2;

//	CMzWnd* pWnd = CMzWnd::FromHandle(GetParent());
	CMzWnd* pWnd = CMzWnd::FromHandle(this->m_hWnd);
	if (pWnd)
		hBmp2 = pWnd->GetWindowBitmap(&rcDst);
	AnimateBitmapEx(NULL, hBmp2, hdc, &rcDst, MZ_ANIMTYPE_SCROLL_TOP_TO_BOTTOM_2);

#endif
	::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
	Show(false, false);

	SetWindowLong(m_hWnd, GWL_USERDATA, (LONG) this);
	return TRUE;
}

void CVideoPlayerTopBarWnd::PaintWin(HDC hdc, RECT* prcUpdate )
{
	BitBlt(hdc, prcUpdate->left, prcUpdate->top,
		RECT_WIDTH(*prcUpdate), RECT_HEIGHT(*prcUpdate),
		m_hBakDC, prcUpdate->left, prcUpdate->top, SRCCOPY);

	CMzWndEx::PaintWin( hdc, prcUpdate );
}
BOOL CVideoPlayerTopBarWnd::OnInitDialog()
{
	if( !CMzWndEx::OnInitDialog() )
	{
		return FALSE;
	}
	::SetWindowText(m_hWnd, L"CVideoPlayerTopBarWnd");

	LoadiInterItem();
	InitBackgrandImages();

	SetForegroundWindow( m_hWnd );
	return TRUE;
}
void CVideoPlayerTopBarWnd::OnMzCommand(WPARAM wParam, LPARAM lParam)
{
	if(LOWORD( wParam ) == m_uiTopBar.m_BtnTopBar[VIDEO_TOPBAR_CLOSE].GetID())
	{
		OnExit();
		return;
	}	
}
void CVideoPlayerTopBarWnd::LoadiInterItem()
{
//jdhuang 20120818
	m_TopBarWndBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 9520);


	m_uiTopBar.SetPos(m_rtTopBarWnd.left,m_rtTopBarWnd.top,
					m_rtTopBarWnd.right-m_rtTopBarWnd.left,
					m_rtTopBarWnd.bottom-m_rtTopBarWnd.top);
	m_uiTopBar.InitUiWin();
	m_uiTopBar.SetVisible(true);
	AddUiWin(&m_uiTopBar);

}
BOOL CVideoPlayerTopBarWnd::InitBackgrandImages()
{

	
	
	HDC hDC = GetDC(m_hWnd);
//jdhuang

	RECT rcClient;
	GetClientRect(m_hWnd, &rcClient);

	m_hBakDC = CreateCompatibleDC(hDC);

	m_hBitmapBakDC = CreateCompatibleBitmap(hDC, RECT_WIDTH(rcClient), RECT_HEIGHT(rcClient));
	SelectObject(m_hBakDC, m_hBitmapBakDC);

	//jdhuang 20090616
//	HDC hMemDc = CreateCompatibleDC(m_hBakDC);

	if(m_TopBarWndBG)
	{
		m_TopBarWndBG->Draw(m_hBakDC, &rcClient, false, false);
//		DeleteDC(hMemDc);
	}
	ReleaseDC(m_hWnd, hDC);

	return TRUE;
}

LRESULT CVideoPlayerTopBarWnd::MzDefWndProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
	default:
		break;
	}
	return CMzWndEx::MzDefWndProc(message,wParam,lParam);
}

void CVideoPlayerTopBarWnd::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
}

void CVideoPlayerTopBarWnd::DestroyWindow()
{
//	DeleteImages();
	PostQuitMessage(0);

	CMzWnd::DestroyWindow();
}
void CVideoPlayerTopBarWnd::OnExit()
{
	DestroyWindow();
}
void CVideoPlayerTopBarWnd::AnimateBitmapEx( HBITMAP hBmp1, HBITMAP hBmp2, HDC hdcDst, RECT *prcDst, UINT animType )
{
	int nX = prcDst->left;
	int nY = prcDst->top;
	int nWidth = RECT_WIDTH(*prcDst);
	int nHeight = RECT_HEIGHT(*prcDst);
	HDC hdcBmp1 = CreateCompatibleDC(hdcDst);
	HDC hdcBmp2 = CreateCompatibleDC(hdcDst);
	HGDIOBJ bmpoldBmp1 = SelectObject(hdcBmp1, hBmp1);
	HGDIOBJ bmpoldBmp2 = SelectObject(hdcBmp2, hBmp2);

//	int iIncrH = 24;
	int iIncrH = 2;
//	int iIncrV = 32;
	int iIncrV = 1;

#define __ALL_USE_STRETCHBLT__

	BOOL bBlt = FALSE;

	switch(animType)
	{
	case MZ_ANIMTYPE_ZOOM_IN:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			double dRatio = (double)RECT_WIDTH(rcDst)/(double)RECT_HEIGHT(rcDst);
			HDC hdcSrc = CreateCompatibleDC(hdcDst);
			HBITMAP hbmpSrc = CreateCompatibleBitmap(hdcDst, nWidth, nHeight);
			HGDIOBJ hbmpold = SelectObject(hdcSrc, hbmpSrc);
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcSrc, 0,0,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
#else
			StretchBlt(hdcSrc, 0,0,nWidth,nHeight,hdcBmp1,0,0,nWidth,nHeight,SRCCOPY);
#endif

			double dAddRatio = 1.2;
			for (int nPos=0; nPos<=nHeight/2; nPos+=nStep,nPos*=dAddRatio)
			{
				//StretchBlt(hdcSrc, nWidth/2-nPos*dRatio, nHeight/2-nPos, nPos*dRatio*2, nPos*2, hdcBmp2, 0,0,nWidth,nHeight,SRCCOPY);
				bBlt = StretchBlt(hdcDst, nX+nWidth/2-nPos*dRatio, nY+nHeight/2-nPos, nPos*dRatio*2, nPos*2, hdcBmp2, 0,0,nWidth,nHeight, SRCCOPY);
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp2,0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp2,0,0,nWidth,nHeight,SRCCOPY);
#endif
			SelectObject(hdcSrc, hbmpold);
			DeleteObject(hbmpSrc);
			DeleteDC(hdcSrc);
		}
		break;
	case MZ_ANIMTYPE_ZOOM_OUT:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			double dRatio = (double)RECT_WIDTH(rcDst)/(double)RECT_HEIGHT(rcDst);
			HDC hdcSrc = CreateCompatibleDC(hdcDst);
			HBITMAP hbmpSrc = CreateCompatibleBitmap(hdcDst, nWidth, nHeight);
			HGDIOBJ hbmpold = SelectObject(hdcSrc, hbmpSrc);
			RECT rcLast = *prcDst;
			double dAddRatio = 1.2;
//			double dAddRatio = 1.1;
			for (int nPos=nHeight/2;nPos>=0;  nPos-=nStep,nPos/=dAddRatio)
			{
				RECT rcDst = rcLast;
				StretchBlt(hdcSrc, rcLast.left,rcLast.top,RECT_WIDTH(rcLast),RECT_HEIGHT(rcLast),hdcBmp2,rcLast.left,rcLast.top,RECT_WIDTH(rcLast),RECT_HEIGHT(rcLast),SRCCOPY);
				rcLast.left=nWidth/2-nPos*dRatio;rcLast.top=nHeight/2-nPos;
				rcLast.right=rcLast.left+nPos*dRatio*2;rcLast.bottom=rcLast.top+nPos*2;
				StretchBlt(hdcSrc, rcLast.left,rcLast.top,RECT_WIDTH(rcLast),RECT_HEIGHT(rcLast),hdcBmp1, 0,0,nWidth,nHeight,SRCCOPY);
				//StretchBlt(hdcSrc, nWidth/2-nPos*dRatio, nHeight/2-nPos, nPos*dRatio*2, nPos*2, hdcBmp1, 0,0,nWidth,nHeight,SRCCOPY);
				StretchBlt(hdcDst, nX+rcDst.left,nY+rcDst.top,RECT_WIDTH(rcDst),RECT_HEIGHT(rcDst),hdcSrc,rcDst.left,rcDst.top,RECT_WIDTH(rcDst),RECT_HEIGHT(rcDst),SRCCOPY);
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp2,0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp2,0,0,nWidth,nHeight,SRCCOPY);
#endif
			SelectObject(hdcSrc, hbmpold);
			DeleteObject(hbmpSrc);
			DeleteDC(hdcSrc);
		}
		break;
	case MZ_ANIMTYPE_SCROLL_BOTTOM_TO_TOP_1:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			//BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
			for (int nPos=0; nPos<=nHeight; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY+nHeight-nPos, nWidth, nPos, hdcBmp2, 0,nHeight-nPos,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY+nHeight-nPos, nWidth, nPos, hdcBmp2, 0,nHeight-nPos,nWidth,nPos,SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth, nHeight-nPos, hdcBmp1, 0,nPos,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth, nHeight-nPos, hdcBmp1, 0,nPos,nWidth, nHeight-nPos, SRCCOPY);
#endif
			}
		}
#ifndef __ALL_USE_STRETCHBLT__
		BitBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
		StretchBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,nWidth, nHeight, SRCCOPY);
#endif
		break;
	case MZ_ANIMTYPE_SCROLL_TOP_TO_BOTTOM_1:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			//BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
			for (int nPos=0; nPos<=nHeight; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY+nPos, nWidth, nHeight-nPos, hdcBmp1, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY+nPos, nWidth, nHeight-nPos, hdcBmp1, 0,0,nWidth, nHeight-nPos, SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth, nPos, hdcBmp2, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth, nPos, hdcBmp2, 0,0,nWidth, nPos, SRCCOPY);
#endif
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,nWidth, nHeight, SRCCOPY);
#endif
		}
		break;
	case MZ_ANIMTYPE_SCROLL_RIGHT_TO_LEFT_1:
		{
			int nStep = iIncrH;
			int nPos = 0;
			RECT rcDst = *prcDst;
			for (int nPos=0; nPos<=nWidth; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth-nPos, nHeight, hdcBmp1, nPos,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth-nPos, nHeight, hdcBmp1, nPos,0,nWidth-nPos, nHeight, SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+nWidth-nPos, nY, nPos, nHeight, hdcBmp2, nWidth-nPos,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+nWidth-nPos, nY, nPos, nHeight, hdcBmp2, nWidth-nPos,0,nPos, nHeight, SRCCOPY);
#endif
			}
		}
		break;
	case MZ_ANIMTYPE_SCROLL_LEFT_TO_RIGHT_1:
		{
			int nStep = iIncrH;
			int nPos = 0;
			RECT rcDst = *prcDst;
			for (int nPos=0; nPos<=nWidth; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+nPos, nY, nWidth-nPos, nHeight, hdcBmp1, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+nPos, nY, nWidth-nPos, nHeight, hdcBmp1, 0,0,nWidth-nPos, nHeight, SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nPos, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nPos, nHeight, hdcBmp2, 0,0,nPos, nHeight, SRCCOPY);
#endif
			}
		}
		break;
	case MZ_ANIMTYPE_SCROLL_BOTTOM_TO_TOP_2:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			//BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
			for (int nPos=0; nPos<=nHeight; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+0, nY+nHeight-nPos, nWidth, nPos, hdcBmp2, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+0, nY+nHeight-nPos, nWidth, nPos, hdcBmp2, 0,0,nWidth, nPos, SRCCOPY);
#endif
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,nWidth, nHeight, SRCCOPY);
#endif
		}
		break;
	case MZ_ANIMTYPE_SCROLL_TOP_TO_BOTTOM_2:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			//BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
			for (int nPos=0; nPos<=nHeight; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth, nPos, hdcBmp2, 0, nHeight-nPos,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth, nPos, hdcBmp2, 0, nHeight-nPos,nWidth, nPos, SRCCOPY);
#endif
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,nWidth, nHeight, SRCCOPY);
#endif
		}
		break;
	case MZ_ANIMTYPE_SCROLL_RIGHT_TO_LEFT_2:
		{
			int nStep = iIncrH;
			int nPos = 0;
			RECT rcDst = *prcDst;
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,nWidth,nHeight,SRCCOPY);
#endif
			for (int nPos=0; nPos<=nWidth; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+nWidth-nPos, nY, nPos, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+nWidth-nPos, nY, nPos, nHeight, hdcBmp2, 0,0,nPos,nHeight,SRCCOPY);
#endif
			}
		}
		break;
	case MZ_ANIMTYPE_SCROLL_LEFT_TO_RIGHT_2:
		{
			int nStep = iIncrH;
			int nPos = 0;
			RECT rcDst = *prcDst;
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX,nY,nWidth,nHeight,hdcBmp1,0,0,nWidth,nHeight,SRCCOPY);
#endif
			for (int nPos=0; nPos<=nWidth; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nPos, nHeight, hdcBmp2, nWidth-nPos,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nPos, nHeight, hdcBmp2, nWidth-nPos,0,nPos,nHeight,SRCCOPY);
#endif
			}
		}
		break;
	case MZ_ANIMTYPE_SCROLL_TOP_TO_BOTTOM_PUSH:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			for (int nPos=0; nPos<=nHeight; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY+nPos, nWidth, nHeight-nPos, hdcBmp1, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY+nPos, nWidth, nHeight-nPos, hdcBmp1, 0,0,nWidth, nHeight-nPos, SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth, nPos, hdcBmp2, 0,nHeight-nPos,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth, nPos, hdcBmp2, 0,nHeight-nPos,nWidth,nPos,SRCCOPY);
#endif
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,nWidth, nHeight, SRCCOPY);
#endif
		}
		break;
	case MZ_ANIMTYPE_SCROLL_BOTTOM_TO_TOP_PUSH:
		{
			int nStep = iIncrV;
			int nPos = 0;
			RECT rcDst = *prcDst;
			for (int nPos=0; nPos<=nHeight; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth, nHeight-nPos, hdcBmp1, 0,nPos,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth, nHeight-nPos, hdcBmp1, 0,nPos,nWidth, nHeight-nPos,SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+0, nY+nHeight-nPos, nWidth, nPos, hdcBmp2, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+0, nY+nHeight-nPos, nWidth, nPos, hdcBmp2, 0,0,nWidth,nPos,SRCCOPY);
#endif
			}
#ifndef __ALL_USE_STRETCHBLT__
			BitBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
			StretchBlt(hdcDst, nX, nY, nWidth, nHeight, hdcBmp2, 0,0,nWidth, nHeight, SRCCOPY);
#endif
		}
		break;
	case MZ_ANIMTYPE_SCROLL_RIGHT_TO_LEFT_PUSH:
		{
			int nStep = iIncrH;
			int nPos = 0;
			RECT rcDst = *prcDst;
			for (int nPos=0; nPos<=nWidth; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nWidth-nPos, nHeight, hdcBmp1, nPos,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nWidth-nPos, nHeight, hdcBmp1, nPos,0,nWidth-nPos, nHeight, SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+nWidth-nPos, nY, nPos, nHeight, hdcBmp2, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+nWidth-nPos, nY, nPos, nHeight, hdcBmp2, 0,0,nPos, nHeight, SRCCOPY);
#endif
			}
		}
		break;
	case MZ_ANIMTYPE_SCROLL_LEFT_TO_RIGHT_PUSH:
		{
			int nStep = iIncrH;
			int nPos = 0;
			RECT rcDst = *prcDst;
			for (int nPos=0; nPos<=nWidth; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX+nPos, nY, nWidth-nPos, nHeight, hdcBmp1, 0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX+nPos, nY, nWidth-nPos, nHeight, hdcBmp1, 0,0,nWidth-nPos, nHeight, SRCCOPY);
#endif
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX, nY, nPos, nHeight, hdcBmp2, nWidth-nPos,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX, nY, nPos, nHeight, hdcBmp2, nWidth-nPos,0,nPos,nHeight,SRCCOPY);
#endif
			}
		}
		break;
	case MZ_ANIMTYPE_FADE:
		{
			int nStep = 40;
			int nPos = 0;
			RECT rcDst = *prcDst;
			HDC hdcSrc = CreateCompatibleDC(hdcDst);
			HBITMAP hbmpSrc = CreateCompatibleBitmap(hdcDst, nWidth, nHeight);
			HGDIOBJ hbmpold = SelectObject(hdcSrc, hbmpSrc);
			for (int nPos=0; nPos<=255; nPos+=nStep)
			{
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcSrc, 0,0,nWidth,nHeight,hdcBmp1,0,0,SRCCOPY);
#else
				StretchBlt(hdcSrc, 0,0,nWidth,nHeight,hdcBmp1,0,0,nWidth,nHeight,SRCCOPY);
#endif
				BLENDFUNCTION bf = {AC_SRC_OVER, 0, nPos, AC_SRC_OVER};
				AlphaBlend(hdcSrc, 0, 0, nWidth, nHeight, hdcBmp2, 0,0,nWidth,nHeight,bf);
#ifndef __ALL_USE_STRETCHBLT__
				BitBlt(hdcDst, nX,nY,nWidth,nHeight,hdcSrc,0,0,SRCCOPY);
#else
				StretchBlt(hdcDst, nX,nY,nWidth,nHeight,hdcSrc,0,0,nWidth,nHeight,SRCCOPY);
#endif
			}
			SelectObject(hdcSrc, hbmpold);
			DeleteObject(hbmpSrc);
			DeleteDC(hdcSrc);
		}
		break;
	}
	SelectObject(hdcBmp2, bmpoldBmp2);
	SelectObject(hdcBmp1, bmpoldBmp1);
	DeleteDC(hdcBmp2);
	DeleteDC(hdcBmp1);
}
